<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of base_hospital
 *
 * @author Administrator
 */
class BaseHospitalModel extends Model {
    //put your code here
    protected $table_name = 'base_hospital';
    public function getByAuto($area,$name) {
        $areaid = 0;
        $where='1';
        if ($area != '') {
            $areaarr = explode(',', $area);
            $areaid = isset($areaarr[1]) ? intval($areaarr[1]) : 0;
            $where.=' and city_id='.$areaid;
        }
        if($name!=''){
            $where.=' and area_name like \'%'.$name.'%\'';
        }
        $list=D('base_hospital')->where($where)->find();
        ///echo $this->getLastSql();
        print_r($list);
    }
}
